#ifndef REPORTTOOL_H
#define REPORTTOOL_H

#include <QObject>
#include <functional>
#include "mytypes.h"
#include <QtXml/QDomDocument>

class ReportTool final:public QObject
{
    Q_OBJECT
public:


    static ReportTool* GetInstance(QObject* parent=nullptr);
    virtual ~ReportTool() override;
    void GetReport();//获取总体检查报告
    void getgenreportdata();//获取总体检查报告数据
    void getdetaileddata();
    void GetAllData();//获取所有信息
    void getdiologinfor(Yzty::Maininfor);//获取对话框信息，包括调用获取所有信息
    void GenReportInit(Yzty::GeneralReport &temp);//总体检查报告的初始化
    bool getxml();//获取xml
    bool getgenhtml();//获取总体检查报告的html
    void getdetailedhtml();//详细检查报告
    void getgenillhtml();//总体违规报告
    void getfilehtml();//文件详细报告
    void getgenfilehtml();//文件总体报告
    void getillfilehtml();//文件违规报告
    void clearAllData(); //清空信息
    QString Tohtmlelem(QString,QString,QString,QString);
    QString Tohtmlelem(QStringList content,QVector<int>,bool flag = false);
    void ToXmlelem(QDomElement&,Yzty::XmlBaceInfo*,bool);
    std::function<void()> GetToolFunction(Yzty::ReportToolCode code);


private:
    explicit ReportTool(QObject* parent=nullptr);
    static ReportTool* _instance;
private:
    Yzty::GeneralReport generalreport;
    QVector<QVector<Yzty::BaceInfor*>> deepinfor;
    QVector<QVector<Yzty::BaceInfor*>> emailinfor;
    QVector<QVector<Yzty::BaceInfor*>> fileinfor;
    QVector<Yzty::BaceInfor*> fileinfor1; //未分类的文件信息
    QVector<QVector<Yzty::BaceInfor*>> hardinfor;
    QVector<QVector<Yzty::BaceInfor*>> normalinfor;
    QVector<QVector<Yzty::BaceInfor*>> securityinfor;
    QVector<QVector<Yzty::BaceInfor*>> virmachineinfor;
    QVector<QVector<Yzty::FileRecordInfor*>> filereportinfor; //文件检查信息
    Yzty::Maininfor dialoginfor;
};

#endif // REPORTTOOL_H
